var express = require('express')

var bodyParser = require('body-parser')

var router = require('./router')

var app = express()

app.use('/public/', express.static('./public/'))

// render会默认去views中找模板
// 配置模板引擎和 body-parser 一定要在 app.use(router) 挂载路由之前
app.engine('html', require('express-art-template'))

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))

// parse application/json
app.use(bodyParser.json())

// 挂载路由
app.use(router)

app.listen(5000, function(){
	console.log('server running 5000...')
})